package com.inno.life.infra.basic.service.impl;

import com.github.pagehelper.Page;
import com.inno.life.infra.basic.entity.PlannerMomentComment;
import com.inno.life.infra.basic.mapper.PlannerMomentCommentDao;
import com.inno.life.infra.basic.service.PlannerMomentCommentService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;


/**
 * (PlannerMomentComment)表服务实现类
 *
 * @author makejava
 * @since 2024-11-25 15:27:17
 */
@Service("plannerMomentCommentService")
public class PlannerMomentCommentServiceImpl implements PlannerMomentCommentService {
    @Resource
    private PlannerMomentCommentDao plannerMomentCommentDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PlannerMomentComment queryById(Long id) {
        return this.plannerMomentCommentDao.queryById(id);
    }



    /**
     * 新增数据
     *
     * @param plannerMomentComment 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerMomentComment insert(PlannerMomentComment plannerMomentComment) {
        this.plannerMomentCommentDao.insert(plannerMomentComment);
        return plannerMomentComment;
    }

    /**
     * 修改数据
     *
     * @param plannerMomentComment 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerMomentComment update(PlannerMomentComment plannerMomentComment) {
        this.plannerMomentCommentDao.update(plannerMomentComment);
        return this.queryById(plannerMomentComment.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.plannerMomentCommentDao.deleteById(id) > 0;
    }

    @Override
    public void updateReplyCount(PlannerMomentComment parentEntity) {
        this.plannerMomentCommentDao.updateReplyCount(parentEntity);
    }

    @Override
    public Page<PlannerMomentComment> queryPage(PlannerMomentComment plannerMomentComment) {
        return this.plannerMomentCommentDao.queryPage(plannerMomentComment);
    }
}
